/**
 * Simple regex experiment to create an automatic emoticons by Indolaron
 * Visit: http://www.indolaron.net
 * Update: 23 Oct 2012
 */

function addSmiley(){
  var postBodyClass = (postBodyClass) ? postBodyClass : 'post-body';
  var d = document.getElementsByClassName(postBodyClass);
  for(var i=0;i<d.length;i++){
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*\)/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/).gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s;-*wowcantik/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/wowcantik.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*o/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/o.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*\(/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/(.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*D/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/D.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*p/g, '<img src="https://arietux.googlecode.com/svn/trunk/smiley/p.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*kiss/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/kisss.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*mads/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/mads.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*hammers/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/hammers.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*capedes/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/capedes.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*rolleyes/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/rolleyes.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*cool:/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/cool_.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*cool/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/cool.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*matabelo/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/matabelo.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*batabig/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/batabig.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*2thumbup/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/2thumbup.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
        d[i].innerHTML = d[i].innerHTML.replace(/\s:-*ngakaks/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/ngakaks.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
    d[i].innerHTML = d[i].innerHTML.replace(/\s:-*beer:/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/beer_.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
    d[i].innerHTML = d[i].innerHTML.replace(/\s:-*Peace:/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/Peace_.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
    d[i].innerHTML = d[i].innerHTML.replace(/\s:-*bingungs/g, ' <img src="https://arietux.googlecode.com/svn/trunk/smiley/bingungs.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
    }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(addSmiley);
